package com.wx_zgwl_client;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.Status;
import org.springframework.stereotype.Component;

/**
 * 刘强
 * 应用健康检查
 * @author
 * @create 2018-01-14 18:08
 **/
@Component
public class MyHealthndicator implements HealthIndicator {

    @Override
    public Health health() {
        if(HealthController.canVisitDb){
            //成功连接数据库，返回up
            return new Health.Builder(Status.UP).build();
        }else{
            //连接数据库失败，返回out of service
            return new Health.Builder(Status.DOWN).build();
        }
    }
}
